package entityBeans;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

@Entity
public class ContactGroup implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int groupID;
	private String groupName;
	public Set<Contact> contacts;

	public ContactGroup() {
		contacts = new HashSet<Contact>();
	}

	@ManyToMany
	public Set<Contact> getContacts() {
		return contacts;
	}

	public void setContacts(Set<Contact> contacts) {
		this.contacts = contacts;
		// for (Contact contact : contacts) {
		// contact.getBooks().add(this);
		// }
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getGroupID() {
		return groupID;
	}

	public void setGroupID(int groupID) {
		this.groupID = groupID;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}
}
